class GrinGenerator

  #``````````````````
  # constructor
  #``````````````````

  def initialize(filename)
    @filename = filename
    @content = []
  end

  #``````````````````
  # interface
  #``````````````````
  
  def add input
    @content << input
  end
  
  def add_text text
    add "#{text}"
  end
  
  def add_image image, text = nil
    text_input = text.nil? ? "" : " #{text}"
    add "image \"#{image}\"#{text_input}"
  end
  
  def save
    File.open(@filename,"w") do |infile| 
      @content.each { |command| infile.puts command }
    end    
  end
  
  
end